package cn.jzq.kotoba.modules.designpattern.template;

public class StringDisplay extends AbstractDisPlay{

    private String showString;

    public StringDisplay(String showString) {
        this.showString = showString;
    }

    @Override
    public void open() {
        printLine();
    }

    @Override
    public void close() {
        printLine();
    }

    @Override
    public void print() {
        System.out.println("|" + showString + "|");
    }

    private void printLine() {
        System.out.print("+");
        for (int i = 0; i < showString.length(); i++) {
            System.out.print("-");
        }
        System.out.println("+");
    }
}
